<script>
	import http from './utils/request.js'
	import modal from './utils/modal.js'
	import { queryParams } from '@/uni_modules/uview-plus';
	export default {
		onLaunch: function() {
			console.log('App Launch')
			const systemInfo = uni.getSystemInfoSync();
			console.log(systemInfo)
			/*
			   https://uniapp.dcloud.net.cn/collocation/pages.html#pages
			   导航栏高度为 44px (不含状态栏)，tabBar 高度为 50px (不含安全区)。
			*/
			// 状态栏高度
			let statuHeight = systemInfo.statusBarHeight
			// 导航栏高度
			let navbarHeight = 44;
			// 底部栏高度
			let tabBarHeight = 50;
			// 屏幕高度
			let screenHeight = systemInfo.screenHeight
			// 屏幕宽度
			let screenWidth = systemInfo.screenWidth
			// 正文区域高度(不包括navbar)
			let mainViewHeight = screenHeight - statuHeight - navbarHeight;
			
			this.globalData.sysInfo.STATUS_BAR_HEIGHT = statuHeight; // 状态栏高度
			this.globalData.sysInfo.NAVBAR_HEIGHT = navbarHeight; // 导航栏高度
			this.globalData.sysInfo.TAB_BAR_HEIGHT = tabBarHeight // 默认tabbar高度
			this.globalData.sysInfo.SCREEN_HEIGHT = screenHeight; // 屏幕高度
			this.globalData.sysInfo.SCREEN_WIDTH = screenWidth; // 屏幕宽度
			this.globalData.sysInfo.MAIN_VIEW_HEIGHT = mainViewHeight // 正文区域高度
			console.log(this.globalData.sysInfo)
		},
		onShow: function() {
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		},
		globalData: {
			sysInfo:{
				STATUS_BAR_HEIGHT: 0,
				SCREEN_WIDTH: 0,
				SCREEN_HEIGHT: 0,
				TAB_BAR_HEIGHT: 0,
				MAIN_VIEW_HEIGHT: 0,
			},
			http: http,
			modal: modal,
			queryParams: queryParams,
		}

	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-plus/index.scss";
	@import "@/static/iconfont.css";

	page {
		background-color: #f2f3f8;
		height: 100%;
	}
</style>